home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 38 / Amiga Format CD38 (1999-03-15)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-04].iso / -websites- / haage&partner / ftp / classx / fm3-demo.lha / FM3-DEMO / Rexx / UpdateProjects.rexx < prev    next >
OS/2 REXX Batch file  |  1997-08-29  |  3KB  |  131 lines

  1. /******************************************************************/
  2. /* ClassX Amiga Rexx script - Copyright © 1997 ClassX Development */
  3. /******************************************************************/
  4.  
  5. /*
  6.     $VER: UpdateProjects.rexx 3.0
  7. */
  8.  
  9. /*
  10. #ITA "Aggiorna Progetti"
  11. #INF "- Descrizione:"
  12. #INF "  La macro esegue una scansione della directory 'FontMachine:Projects'"
  13. #INF "  convertendo i vecchi progetti realizzati con FontMachine v1.xx"
  14. #INF "  nel formato utilizzato dalla v2.xx e successive versioni."
  15. #INF "- Uso:"
  16. #INF "  La conversione è completamente automatica e non richiede"
  17. #INF "  alcuna interazione con l'utente."
  18. #END
  19. */
  20.  
  21. /*
  22. #ENG "Update Projects"
  23. #INF "- Description:"
  24. #INF "  The macro scans the 'FontMachine:Projects' and converts the"
  25. #INF "  old FontMachine v1.xx projects into the format used by v2.xx"
  26. #INF "  and following versions."
  27. #INF "- Usage:"
  28. #INF "  The conversion is completely automatic and doesn't need any"
  29. #INF "  user input."
  30. #END
  31. */
  32.  
  33. MYPORT = 'FontMachine'
  34.  
  35. IF ~SHOW('P', MYPORT) THEN DO
  36.     IF EXISTS('FontMachine:FontMachine') THEN DO
  37.         ADDRESS COMMAND 'Run >NIL: FontMachine:FontMachine'
  38.         DO 30 WHILE ~SHOW('P',MYPORT)
  39.              ADDRESS COMMAND 'Wait >NIL: 1 SEC'
  40.         END
  41.     END
  42.     ELSE DO
  43.         SAY "FontMachine could not be loaded."
  44.         EXIT 10
  45.     END
  46. END
  47.  
  48. IF ~SHOW('P', MYPORT) THEN DO
  49.     SAY 'FontMachine Rexx port could not be opened.'
  50.     EXIT 10
  51. END
  52.  
  53. ADDRESS VALUE MYPORT
  54. OPTIONS RESULTS
  55. OPTIONS FAILAT 10000
  56.  
  57. /* Make sure rexxsupport library is opened */
  58. IF ~SHOW('L','rexxsupport.library') THEN CALL ADDLIB('rexxsupport.library',0,-30)
  59.  
  60. SIGNAL ON Break_C
  61. SIGNAL ON Break_D
  62.  
  63. /******************************************************************/
  64.  
  65. LockGui
  66.  
  67. /* set relevant paths for projects and temp files */
  68. PrjDir = 'FontMachine:Project/'
  69.  
  70. /* scan the projects dir */
  71. Files = SHOWDIR(PrjDir,'f',"|")
  72. fLength = LENGTH(Files)
  73.  
  74. nList=0
  75. do while fLength>0
  76.     cLength=pos('|',Files)
  77.     if cLength=0 then do
  78.         cLength=FLength+1
  79.         fLength=0
  80.     end
  81.     cFile = left(Files,cLength-1)
  82.     pFile = PrjDir||cFile
  83.  
  84.     /* Check for valid v1.xx projects */
  85.     IF OPEN('in',pFile,'R') then do
  86.         IF (READLN('in')='#FONTMACHINE 1') then do
  87.  
  88.             /* Ok, go on with the project */
  89.             FreeFont
  90.             FreeTexture Front
  91.             FreeTexture Border
  92.             LoadProject pFile
  93.             IF RC=0 THEN SaveProject pFile
  94.             ELSE Request '"ARexx Error"' '"'FM_ERROR'"' 'Ok'
  95.  
  96.         END
  97.         CLOSE('in')
  98.     END
  99.  
  100.     /* next project */
  101.     if FLength~=0 then Files=right(Files,fLength-cLength)
  102.     fLength=fLength-cLength
  103. END
  104.  
  105. Request '"ARexx Message"' '"End"' 'Ok'
  106.  
  107. UnLockGui
  108. EXIT
  109.  
  110. /******************************************************************/
  111.  
  112. WaitRender: PROCEDURE
  113.     /* wait the rendering of the font */
  114.     DO FOREVER
  115.         CheckRedraw
  116.         if FM_RESULT ~= 0 then ADDRESS COMMAND 'Wait >NIL: 1 SEC'
  117.         else LEAVE
  118.     END
  119. RETURN
  120.  
  121. /******************************************************************/
  122.  
  123. /* break handlers */
  124. Break_C:
  125. Break_D:
  126.     UnLockGui
  127.     Request '"FontMachine"' '"Procedure Stopped"' 'Ok'
  128. RETURN
  129.  
  130. /******************************************************************/
  131.